home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 May / Chip Mayıs 2001.iso / prog / share / 14 / setup.exe / %MAINDIR% / Scripts / Java script sample 2.js < prev    next >
Encoding:
JavaScript  |  2001-03-30  |  1.8 KB  |  56 lines

  1. // File:         CuteFTP_Pro_Sample2.js
  2. // Description:  Sample of using TEConnection object 
  3. //             from java script.
  4. //         This script connects to ftp server changes the remote 
  5. //         folder and downloads a file from it.
  6. // Created:      February 7, 2001
  7. // Copyright (c) 2000 GlobalSCAPE, Inc.
  8. //    The copyright to the computer program(s) herein
  9. //    is the property of GlobalSCAPE, Inc.
  10. //    The program(s) may be used and/or copied  only with
  11. //    the written permission of  GlobalSCAPE, Inc.
  12. //    or in accordance   with the terms and conditions
  13. //    stipulated   in the agreement/contract under which
  14. //    the  program(s) have been supplied.
  15. //
  16.  
  17.  
  18. //Create TEConnection object
  19. var TEConnection  = WScript.CreateObject("CuteFTPPro.TEConnection")
  20.  
  21. //Create standard Shell object
  22. var Shell = WScript.CreateObject("WScript.Shell")
  23.  
  24. //Specify connection properties
  25. TEConnection.Protocol = "FTP"
  26. TEConnection.Host = "ftp.cuteftp.com"
  27. TEConnection.Login = "ftp"
  28. TEConnection.UseProxy = "BOTH"
  29. TEConnection.RemoteFolder = "/Pub/CuteFTP"
  30.  
  31. //Get name of desktop folder
  32. strMyDocuments  = Shell.SpecialFolders("MyDocuments")
  33. TEConnection.Localfolder = strMyDocuments 
  34.  
  35. //Display prompt
  36. nUserChoise = Shell.Popup("Script will connect to the ftp server and download a txt file to the MyDocuments folder.", 0, "CuteFTP Pro Connection Sample Script", 1)
  37.  
  38. if (nUserChoise == 2)
  39. {
  40.  
  41. }
  42. else if ( !TEConnection.RemoteExists("index.txt"))
  43. {
  44.     //Alert the user that the file requested does not exist on the server.
  45.     Shell.Popup("Remote file does not exist")
  46. }
  47. else
  48. {
  49.     //Initiate download                                         
  50.     Shell.popup("File Transfer will be started.\nCheck your CuteFTP pro Transfer Engine to check the download status.")
  51.     TEConnection.Download("index.txt", strMyDocuments +"\\index.txt")
  52. }
  53.  
  54.  
  55.  
  56.